App.Reserves.Controller.StoreDetail = Backbone.View.extend({
	//Initialize
	initialize: function(){
		App.Utils.mask();
		var controller = this;		
		var model = new App.Reserves.Model.Store(
		);

    	App.Reserves.Delegate.ReservesDelegate.storeRead(model, {
    		success:function (data) {
    			App.Utils.unmask();
    			controller.model = data;
    			controller.init();
            },
        	error:function(data){
        		App.Utils.unmask();
  		  		App.Utils.setFailureMessage('Error reading app.reserves.controller.storedetail!');
  		  		Backbone.history.navigate("home",true);
        }});
    },
    //Initialize the controller to show the associated view.
	init: function(){
    	// Compile the template using underscore
        this.view = _.template(App.Utils.getView('invalid/view/storeDetail'));
        this.model.bind("reset", this.render, this);
        this.render();
    },
    events: {
    },
    render: function(){
    	//Triggers the model refresh to be pased to the view
    	this.model.change();
    	//Renders the view with the associated elements
        $(this.el).html( this.view({model:this.model}) );
    	//Show the view
        App.Utils.changePage(this);
    	return this;
    }
});
